#ifndef DISKMEMORY_H_
#define DISKMEMORY_H_

#include <stdio.h>
#include <stdlib.h>
#include <semaphore.h>
#include "confFile.h"
#include "pMailbox.h"

char* diskMemory;
char* diskGetPage(int pAddress);
void diskSetPage(int pAddress, char* page);
void initDiskMemory();
void killDiskMemory();

//Process control block
typedef struct pcbRec{
	int pid;			//process id
	int startPageIndex;	//the process entry point in disk
	int isOccupied;		//0 = free space, 1 = occupied
	sem_t* waitForPRM;
	blockingQueue* mailbox; //the process mailbox
}pcbRecord;

pcbRecord* pcb;

void initPCB();
int pcbAddProcess(int processID, int startPageIndex);
void pcbRemoveProcess(int processID);
int pcbGetProcessPageStartIndex(int processID);
void killPCB();
void printDisk();

#endif /*DISKMEMORY_H_*/
